package vip.xiaonuo.smzq.modular.kcl.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import vip.xiaonuo.common.pojo.CommonResult;
import vip.xiaonuo.smzq.modular.kcl.entity.Ksshjl;
import vip.xiaonuo.smzq.modular.kcl.service.IKsshjlService;

import javax.annotation.Resource;
import javax.validation.Valid;


/**
 * 矿山审核记录表
 *
 * @author yxt
 * @since 2024-02-28
 */
@Api(tags = "矿山审核记录表")
@RestController
@RequestMapping("/kcl/ksshjl")
@Validated
public class KsshjlController {

    @Resource
    private IKsshjlService iKsshjlService;

    /**
     * 添加矿山审核记录表
     */
    @ApiOperation("添加矿山审核记录表")
    @PostMapping("/add")
    public CommonResult<String> add(@RequestBody @Valid Ksshjl ksshjl) {
        iKsshjlService.save(ksshjl);
        return CommonResult.ok();
    }

    /**
     * 删除矿山审核记录表
     */
    @ApiOperation("删除矿山审核记录表")
    @PostMapping("/delete")
    public CommonResult<String> delete(@ApiParam(name = "pkid", value = "主键") @RequestParam String pkid) {
        iKsshjlService.removeById(pkid);
        return CommonResult.ok();
    }

    /**
     * 编辑矿山审核记录表
     */
    @ApiOperation("编辑矿山审核记录表")
    @PostMapping("/edit")
    public CommonResult<String> edit(@RequestBody @Valid Ksshjl ksshjl) {
        iKsshjlService.updateById(ksshjl);
        return CommonResult.ok();
    }

    /**
     * 矿山审核记录表分页查询
     */
    @ApiOperation("矿山审核记录表分页查询")
    @GetMapping("/list")
    public CommonResult<Page<Ksshjl>> page(@ApiParam(name = "ksId", value = "矿山id") @RequestParam String ksId) {
        return CommonResult.data(iKsshjlService.page(ksId));
    }
}
